package Util::CreditType::CreditType;
use Moose;
use namespace::autoclean;

has 'schema' => (
	is => 'rw',
	required => 1,
	isa => 'DBIx::Class::Schema',
);

sub get_all_credit_types{
	my ($self) = @_;

	return $self->schema->resultset('CreditType')->search({},{});
}

sub get_credit_types_by_target{
	my ($self,$target_type) = @_;

	return $self->schema->resultset('CreditType')->search({'target_type' => $target_type},{});
}


sub find{
        my ($self, $credit_type_id) = @_;
	return $self->schema->resultset('CreditType')->search({'id' => $credit_type_id},{})->first();
}

__PACKAGE__->meta->make_immutable;

1;
